{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "class MyQueue(object):\n",
    "\n",
    "    def __init__(self):\n",
    "        \"\"\"\n",
    "        Initialize your data structure here.\n",
    "        \"\"\"\n",
    "        self.q = []\n",
    "        \n",
    "\n",
    "    def push(self, x):\n",
    "        \"\"\"\n",
    "        Push element x to the back of queue.\n",
    "        :type x: int\n",
    "        :rtype: None\n",
    "        \"\"\"\n",
    "        self.q.append(x)\n",
    "        \n",
    "\n",
    "    def pop(self):\n",
    "        \"\"\"\n",
    "        Removes the element from in front of queue and returns that element.\n",
    "        :rtype: int\n",
    "        \"\"\"\n",
    "        front = self.q[0]\n",
    "        self.q = self.q[1:]\n",
    "        return front\n",
    "\n",
    "    def peek(self):\n",
    "        \"\"\"\n",
    "        Get the front element.\n",
    "        :rtype: int\n",
    "        \"\"\"\n",
    "        return self.q[0]\n",
    "        \n",
    "\n",
    "    def empty(self):\n",
    "        \"\"\"\n",
    "        Returns whether the queue is empty.\n",
    "        :rtype: bool\n",
    "        \"\"\"\n",
    "        if self.q:\n",
    "            return False\n",
    "        else:\n",
    "            return True\n",
    "\n",
    "\n",
    "# Your MyQueue object will be instantiated and called as such:\n",
    "# obj = MyQueue()\n",
    "# obj.push(x)\n",
    "# param_2 = obj.pop()\n",
    "# param_3 = obj.peek()\n",
    "# param_4 = obj.empty()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
